package exemplo.faces;

import java.sql.SQLException;


import exemplo.database.LoginDAO;

public class LoginFace {

	private LoginDAO loginDAO;
	private String username;
	private String password;
	
	public LoginFace() throws SQLException, ClassNotFoundException {
		loginDAO = new LoginDAO();
	}
	
	public String doLogin() throws SQLException, ClassNotFoundException {
		boolean b = loginDAO.validateUser(username, password);
		if (b) {
			return "gotoFirstPage";
		} else {
			return "gotoErrorPage";		
		}
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	
}
